package models;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@Table(name = "VehicleInfo", schema = "dbo", catalog = "GPSInfo_Test")
public class VehicleInfoEntity {
    private int id;
    private String vehicleId;
    private String plateNo;
    private String sendTime;
    private Double longitude;
    private Double latitude;
    private Double velocity;
    private Integer direction;
    private String status;
    private Double mileage;
    private Double oil;
    private Double recordVelocity;
    private String location;

    @Id
    @Column(name = "ID", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "VehicleId", nullable = true, length = 255)
    public String getVehicleId() {
        return vehicleId;
    }

    public void setVehicleId(String vehicleId) {
        this.vehicleId = vehicleId;
    }

    @Basic
    @Column(name = "PlateNo", nullable = true, length = 255)
    public String getPlateNo() {
        return plateNo;
    }

    public void setPlateNo(String plateNo) {
        this.plateNo = plateNo;
    }

    @Basic
    @Column(name = "SendTime", nullable = true)
    public String getSendTime() {
        return sendTime;
    }

    public void setSendTime(String sendTime) {
        this.sendTime = sendTime;
    }

    @Basic
    @Column(name = "Longitude", nullable = true, precision = 0)
    public Double getLongitude() {
        return longitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }

    @Basic
    @Column(name = "Latitude", nullable = true, precision = 0)
    public Double getLatitude() {
        return latitude;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    @Basic
    @Column(name = "Velocity", nullable = true, precision = 0)
    public Double getVelocity() {
        return velocity;
    }

    public void setVelocity(Double velocity) {
        this.velocity = velocity;
    }

    @Basic
    @Column(name = "Direction", nullable = true)
    public Integer getDirection() {
        return direction;
    }

    public void setDirection(Integer direction) {
        this.direction = direction;
    }

    @Basic
    @Column(name = "Status", nullable = true, length = 255)
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Basic
    @Column(name = "Mileage", nullable = true, precision = 0)
    public Double getMileage() {
        return mileage;
    }

    public void setMileage(Double mileage) {
        this.mileage = mileage;
    }

    @Basic
    @Column(name = "Oil", nullable = true, precision = 0)
    public Double getOil() {
        return oil;
    }

    public void setOil(Double oil) {
        this.oil = oil;
    }

    @Basic
    @Column(name = "RecordVelocity", nullable = true, precision = 0)
    public Double getRecordVelocity() {
        return recordVelocity;
    }

    public void setRecordVelocity(Double recordVelocity) {
        this.recordVelocity = recordVelocity;
    }

    @Basic
    @Column(name = "Location", nullable = true, length = 255)
    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        VehicleInfoEntity that = (VehicleInfoEntity) o;
        return id == that.id &&
                Objects.equals(vehicleId, that.vehicleId) &&
                Objects.equals(plateNo, that.plateNo) &&
                Objects.equals(sendTime, that.sendTime) &&
                Objects.equals(longitude, that.longitude) &&
                Objects.equals(latitude, that.latitude) &&
                Objects.equals(velocity, that.velocity) &&
                Objects.equals(direction, that.direction) &&
                Objects.equals(status, that.status) &&
                Objects.equals(mileage, that.mileage) &&
                Objects.equals(oil, that.oil) &&
                Objects.equals(recordVelocity, that.recordVelocity) &&
                Objects.equals(location, that.location);
    }

    @Override
    public int hashCode() {

        return Objects.hash(id, vehicleId, plateNo, sendTime, longitude, latitude, velocity, direction, status, mileage, oil, recordVelocity, location);
    }
}
